package com.miraclemiles.oauth.service;

import javax.sql.DataSource;

import org.springframework.cache.annotation.Cacheable;
import org.springframework.security.oauth2.provider.ClientDetails;
import org.springframework.security.oauth2.provider.client.JdbcClientDetailsService;

public class RedisClientDetailsService extends JdbcClientDetailsService {
	
    public RedisClientDetailsService(DataSource dataSource) {
        super(dataSource);
    }

	@Cacheable(value = "oauth_client_details:", key = "#clientId", unless = "#result == null")
    @Override
    public ClientDetails loadClientByClientId(String clientId) {
		return super.loadClientByClientId(clientId);
    }

}
